import request from "@/api/config";
import { AxiosPromise } from 'axios';
import {PORT} from "@/leadmall/api/config/servicePort";
import { NoteCateVO, NoteCateForm, NoteCateQuery } from '@/leadmall/api/noteCate/types';

/**
 * 查询公告分类列表
 * @param query
 * @returns {*}
 */

export const listNoteCate = (query?: NoteCateQuery): AxiosPromise<NoteCateVO[]> => {
  return request({
    url: PORT +'/leadmall/noteCate/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询公告分类详细
 * @param id
 */
export const getNoteCate = (id: string | number): AxiosPromise<NoteCateVO> => {
  return request({
    url: PORT +'/leadmall/noteCate/' + id,
    method: 'get'
  });
};

/**
 * 新增公告分类
 * @param data
 */
export const addNoteCate = (data: NoteCateForm) => {
  return request({
    url: PORT +'/leadmall/noteCate',
    method: 'post',
    data: data
  });
};

/**
 * 修改公告分类
 * @param data
 */
export const updateNoteCate = (data: NoteCateForm) => {
  return request({
    url: PORT +'/leadmall/noteCate',
    method: 'put',
    data: data
  });
};

/**
 * 删除公告分类
 * @param id
 */
export const delNoteCate = (id: string | number | Array<string | number>) => {
  return request({
    url: PORT +'/leadmall/noteCate/' + id,
    method: 'delete'
  });
};
